using System;
using System.IO;
using System.Collections.Generic;
using System.Text;

using Walkmen.Util;

namespace Walkmen.OpenMG
{
    public class OMATXXXFrame: OMATextFrame
    {
        public const string FRAME_ID = "TXXX";
        public const string DESCRIPTION_ALBMS = "OMG_ALBMS";
        public const string DESCRIPTION_TRACK = "OMG_TRACK";
        public const string DESCRIPTION_TPE1S = "OMG_TPE1S";
        public const string DESCRIPTION_TIT2S = "OMG_TIT2S";
        public const string DESCRIPTION_TRLDA = "OMG_TRLDA";

        private string _description;

        public string Description
        {
            get { return _description; }
            set { _description = value; }
        }

        protected override void ParseValue(byte[] value)
        {
            base.Encoding = (OMAEncoding)value[0];
            Encoding encoding = CodeToEncoding(base.Encoding);

            string[] text = encoding.GetString(value, 1, value.Length - 1).Split('\0');

            _description = StringUtils.TrimEx(text[0]);
            base.Value = StringUtils.TrimEx(text[1]);
        }
    }
}
